<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box{
        display: flex;
    }
    .box1{
        width: 30px;
        height: 30px;
        background-color: red;
        margin-left: 20px;
    }
    .box2{
        width: 30px;
        height: 30px;
        margin-left: 20px;
        background-color: chartreuse;
    }
    .box3{
        width: 30px;
        height: 30px;
        margin-left: 20px;
        background-color:#111;
    }
    ul{
        width: 600px;
        display: flex;
    }
    li{
        list-style: none;
        width: 100px;
        height: 20px;
        text-align: center;
        border: 1px solid green;
        color: green;
    }
    .home{
        width: 100%;
        height: 500px;
    }
    *{
        margin: 0;
        padding: 0;
    }
</style>
<body>
    <div class="home">
        <div class="box">
            <div class="box1" onclick="red()"></div>
            <div class="box2" onclick="green()"></div>
            <div class="box3" onclick="black()"></div>
        </div>
    </div>
    <ul>
        <li>新闻</li>
        <li>娱乐</li>
        <li>体育</li>
        <li>电影</li>
        <li>音乐</li>
        <li>旅游</li>
    </ul>
</body>
<script>
    var hh=document.querySelector('.home')
    var yy=document.querySelector('li')
    function red() {
        hh.style.backgroundColor='red'
        yy.style.backgroundColor='red'
        console.log(111);
    }
    function green() {
        hh.style.backgroundColor='green'
        yy.style.backgroundColor='green'
        console.log(111);
    }
    function black() {
        hh.style.backgroundColor='black'
        yy.style.backgroundColor='black'
        console.log(111);
    }
</script>
</html>